package com.centaline.androidsalesblog.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.List;

/**
 * 房贷计算器 ,税费计算器,我要约看 中TabLayout用到的适配器
 * Created by admin on 2016/2/23.
 */
public class FragmentTabLayoutAdapter extends FragmentPagerAdapter {

    private List<String> list;
    private List<Fragment> fragmentList;
    public FragmentTabLayoutAdapter(FragmentManager fm,List<Fragment> fragmentList,List<String> list) {
        super(fm);
        this.fragmentList = fragmentList;
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return fragmentList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentList.size();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position%list.size());
    }
}
